 /**
 * @file tal_zcl_scene.h
 * @brief Common process - scene manager
 * @version 1.0.0
 * @date 2021-09-19
 *
 * @copyright Copyright 2018-2021 Tuya Inc. All Rights Reserved.
 *
 */
#ifndef __TAL_ZCL_SCENE_H__
#define __TAL_ZCL_SCENE_H__


#ifdef __cplusplus
    extern "C" {
#endif

#include "tuya_cloud_types.h"
#include "tuya_zigbee_stack.h"

/*
 *  scene data type
 */
typedef enum {
    TAL_SCENE_DATA_TYPE_EXT_SERVER = 0, ///< scene data with extension field, save scene data in sdk
    TAL_SCENE_DATA_TYPE_YOURSELF = 1,   ///< scene data without extension field, save scene data not in sdk
    TAL_SCENE_DATA_TYPE_ZIGBEE = 2,     ///< not used 
} TAL_SCENE_TYPE_T;

/*
 *  scene data
 */
typedef struct {
    TAL_SCENE_TYPE_T type;              ///< scene data storage type
    UINT8_T          len;               ///< length of scene data
    UINT8_T         *pdata;             ///< point to space of data storage
} TAL_SCENE_DATA_T;

/**
 * @brief pre-save scene callback
 * @note < this is a weak function you can rewrite this API in app layer >
 *
 * @param[in]   ep_id:    endpoint id
 * @param[in]   scene_id: scene id
 * @param[in]   group_id: group id
 * @return  none
 */
VOID_T tal_zg_scene_pre_save_callback(UINT8_T ep_id, UINT8_T scene_id, UINT16_T group_id);

/**
 * @brief save scene callback(add scene and store scene)
 * @note < this is a weak function you can rewrite this API in app layer >
 *
 * @param[in]   ep_id:    endpoint id
 * @param[in]   scene_id: scene id
 * @param[in]   group_id: group id
 * @param[in]   data:     point to scene data
 * @return  none
 */
VOID_T tal_zg_scene_save_callback(UINT8_T ep_id, UINT8_T scene_id, UINT16_T group_id, TAL_SCENE_DATA_T *data);

/**
 * @brief recall scene callback
 * @note < this is a weak function you can rewrite this API in app layer >
 *
 * @param[in]   ep_id:     endpoint id
 * @param[in]   scene_id:  scene id
 * @param[in]   group_id:  group id
 * @param[in]   time100ms: scene transition time(bat:100ms)
 * @param[in]   data:      point to scene data
 * @return  none
 */
VOID_T tal_zg_scene_recall_callback(UINT8_T ep_id, UINT8_T scene_id, UINT16_T group_id, UINT_T time100ms, TAL_SCENE_DATA_T *data);

/**
 * @brief remove scene callback
 * @note < this is a weak function you can rewrite this API in app layer >
 *
 * @param[in]   ep_id:     endpoint id
 * @param[in]   scene_id:  scene id
 * @param[in]   group_id:  group id
 * @return  none
 */
VOID_T tal_zg_remove_scene_callback( UINT8_T ep_id, UINT8_T scene_id, UINT16_T group_id);

#ifdef __cplusplus
}
#endif

#endif

